package ui.map 
{
	import com.asual.swfaddress.SWFAddress;
	import com.greensock.TweenMax;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import model.Model;
	import utils.TextFieldUtil;
	
	/**
	 * ...
	 * @author usual
	 */
	public class GoogleCredits extends MovieClip 
	{
		private var _txt:TextField;
		
		public function GoogleCredits() 
		{
			addEventListener(Event.ADDED_TO_STAGE, build);
		}
		
		private function build(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, build);
			addText();
			this.buttonMode = true;
			this.mouseChildren = false;
			this.addEventListener(MouseEvent.CLICK, _onClik);
			TweenMax.to(this, 1, {dropShadowFilter:{color:0x151515, alpha:1, blurX:12, blurY:12, distance:0,strength:2}});
		}
		
		private function _onClik(e:MouseEvent):void 
		{
			SWFAddress.href(Model.instance.getUiLabel('credit-google-url'), '_blank');
		}
		
		private function addText():void 
		{
			_txt = new TextField();
			_txt.selectable = false;
			TextFieldUtil.setText(_txt, "<googleCredits>" + Model.instance.getUiLabel('credit-google') + "</googleCredits>");
			trace("[GoogleCredits.addText] ",Model.instance.getUiLabel('credit-google'));
			addChild(_txt);
		}
		
	}

}